/**
 * build_project
 * <p>
 * Copyright 2014 cayden.cn, Inc. All rights reserved.
 *
 * @author Administrator
 * @date 2021-07-08 16:53
 */
package com.cayden.config.boot.component;

import com.cayden.config.EnvironmentHolder;
import org.springframework.context.ConfigurableApplicationContext;

/**
 *
 * @author cayden
 * @date 2021-07-08 16:53
 */
public interface ComponentInitializer extends AutoConfigExcluder {

    default void initialize(ConfigurableApplicationContext applicationContext) {
    }

    default void setPropertyIfMissing(String key, Object value) {
        if (!EnvironmentHolder.get().containsProperty(key)) {
            System.setProperty(key, value.toString());
        }
    }
}
